<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    
  </head>
  <!-- end header -->
  <body>
    <div class="page-group">
      <div class="page page-current">
        
        <header class="bar bar-nav fs-header-small">
          <a href="${ctx.host}/profile" class="icon icon-left pull-left"></a>
          <h1 class="title">代言人信息</h1>
        </header>
        
        <div class="content">
        
           <div class="agent-banner">
            <div class="row">
              <div class="col-50 text-center">
                <span class="word">总购买人数</span><br>
                <span class="amount">${agent.purchaserTotal}</span>
              </div>
              <div class="col-50 text-center">
                <span class="word">总推荐奖励</span><br>
                <span class="amount"><fmt:formatNumber value="${agent.kickbackTotal/100}" maxFractionDigits="2" pattern="0.00"/></span>
              </div>
            </div>
          </div>          
          <!-- end agent banner -->
          
          <div class="card no-margin">
            <div class="card-header">折扣码</div>
              <div class="card-content">
                <div class="card-content-inner" style="padding:0;">
                  <div class="list-block info-list-item agent-list" style="margin: 0 0.5rem 0 0;">
                    <ul style="border:0;">
                      <c:forEach var="agentDiscount" items="${agentDiscounts}">
                        <li>
                          <div class="item-content item-inner">
                            <div class="item-title">
                              <c:choose>
                                <c:when test="${agentDiscount.discountType.discount}">
                                  <div class="agent-cover"><i class="icon icon-agent"></i> <span style="font-size:.75rem;">${agentDiscount.discountCode}</span></div>
                                  优惠&nbsp;${agentDiscount.userDiscount}%,&nbsp;&nbsp;&nbsp;&nbsp;推荐奖励&nbsp;${agentDiscount.commissionPercent}%
                                </c:when>
                                <c:when test="${agentDiscount.discountType.payment}">
                                  <div class="agent-cover"><i class="icon icon-agent"></i> <span style="font-size:.75rem;">${agentDiscount.discountCode}</span></div>
                                  优惠&nbsp;${agentDiscount.discountOffer/100}元,&nbsp;&nbsp;&nbsp;&nbsp;推荐奖励&nbsp;${agentDiscount.commission/100}元
                                </c:when>
                              </c:choose>
                            </div>
                          </div>
                        </li>
                      </c:forEach>
                    </ul>
      
                  </div>
                </div>
              </div>
              <div class="card-footer">折扣说明</div>
            </div>
            <!-- End card -->
            
            <div class="list-block info-list-item" style="margin: 0.5rem 0;">
            <ul>
              <li>
                <a href="${ctx.host}/profile-online-agent/student" class="item-content item-link">
                  <div class="item-inner">
                    <div class="item-title">折扣学员</div>
                  </div>
                </a>
              </li>
              <li>
                <a href="#account-edit" class="item-content item-link" data-toggle="push">
                  <div class="item-inner">
                    <div class="item-title"> 收款账户</div>
                  </div>
                </a>
              </li>
              <li>
                <a href="${ctx.host}/profile-online-agent/agent-record" class="item-content item-link">
                  <div class="item-inner">
                    <div class="item-title">收支记录</div>
                  </div>
                </a>
              </li>
            </ul>

          </div>
          
          <!-- End banner -->
        </div>
        <!-- End Content -->
        
      </div>
    </div>
    
    <%@ include file="/WEB-INF/include/script.jsp"%>
    <d:resource type="script" root="${ctx.resource}/build" src="js/page/profile/profile-online-agent.js" />
    <script type="text/javascript">
      var jsConfig = JSON.parse('${wechatJsConfig}')
      require(['page/profile/profile-online-agent'], function(page) {
        page.init({
          jsConfig: jsConfig
        })
      })
    </script>
   
  </body>
</html>